package com.iretailer.report.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iretailer.report.mapper.SalesMapper;
import com.iretailer.report.model.Sales;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: xjw
 * @Date: 2019/1/21 15:20
 * @Description:
 */
@Service
public class SalesService extends ServiceImpl<SalesMapper, Sales> {

    @Autowired
    private SalesMapper salesMapper;

    public int insertSales(List<Sales> sales) {
        return salesMapper.replace(sales);
    }


    @Override
    public List<Sales> list(Wrapper<Sales> queryWrapper) {
        return salesMapper.selectList(queryWrapper);
    }

    public List<Sales> queryMallsSales(List<String> mallIds, String startDate, String endDate) {
        return salesMapper.selectGroupByMallAndDate(mallIds, startDate, endDate);
    }


}
